<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.milk.entity.Stock" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>查看库存信息</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(90deg, #ff9a9e, #fad0c4);
            padding: 20px;
        }

        .container {
            background: #fff;
            border-radius: 10px;
            box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
            padding: 30px;
            width: 90%;
            max-width: 500px;
            text-align: center;
        }

        h2 {
            color: #333;
            margin-bottom: 20px;
            font-size: 24px;
        }

        .stock-info {
            text-align: left;
            margin-bottom: 20px;
        }

        .stock-info p {
            font-size: 16px;
            color: #555;
            margin-bottom: 10px;
        }

        .stock-info strong {
            color: #333;
            font-weight: bold;
        }

        .error-message {
            color: red;
            font-size: 16px;
            margin-bottom: 20px;
        }

        .return-button {
            display: inline-block;
            padding: 12px 24px;
            background-color: #6c757d;
            color: white;
            text-decoration: none;
            border-radius: 20px;
            transition: background-color 0.3s ease;
            font-size: 14px;
            font-weight: bold;
            letter-spacing: 1px;
            text-transform: uppercase;
        }

        .return-button:hover {
            background-color: #5a6268;
        }

        @media (max-width: 600px) {
            .container {
                padding: 20px;
            }

            h2 {
                font-size: 20px;
            }

            .stock-info p {
                font-size: 14px;
            }

            .return-button {
                padding: 10px 20px;
                font-size: 12px;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <h2>查看库存信息</h2>
    <%
        Stock stock = (Stock) request.getAttribute("stock");
        if (stock != null) {
    %>
    <div class="stock-info">
        <p><strong>饮品ID：</strong><%=stock.getDrinkId()%></p>
        <p><strong>当前库存数量：</strong><%=stock.getQuantity()%></p>
        <p><strong>库存预警阈值：</strong><%=stock.getLowStockThreshold()%></p>
    </div>
    <%
    } else {
    %>
    <p class="error-message">未找到对应饮品的库存信息，请检查输入的ID是否正确。</p>
    <%
        }

    %>
    <a href="${pageContext.request.contextPath}/stock/viewAll" class="return-button">返回库存列表</a>
</div>
</body>
</html>